<template>
  <view>
    <!-- 用户须知 -->
    <view class="notice_box">
      <view class="notice_title">预约须知 </view>
      <rich-text class="notice_text" :nodes="nodes"></rich-text>
    </view>

    <!-- 按钮组 -->
    <view class="notice_sureBox">
      <view class="notice_check">
        <checkbox
          value="1"
          :checked="checkeFlag"
          @click="checke()"
        />我已阅读并同意预约须知</view
      >
      <view class="notice_btnBox">
        <button class="notice_cancel" @click="cancel()">取消</button>
        <button
          :class="{
            notice_sure: true,
            isChecke: !checkeFlag,
          }"
          :disabled="!checkeFlag"
          @click="sure()"
        >
          预约
        </button>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      noticeInfo:
        "1、初诊号源均每天早7:30开放预约，预约号源全部实行分时段预约。2、初诊提前3天预约；复诊可直接与主诊医生预约，无时限要求。3、患者至少提前24小时进行预约挂号，每天16:30截止第二天号源的预约。",

      nodes: [
        {
          name: "div",
          attrs: {
            class: "div-class",
            style: "margin-left: 6px; margin-top: 6px;",
          },
          children: [
            {
              type: "text",
              text: "1、初诊号源均每天早7:30开放预约，预约号源全部实行分时段预约。\n",
            },
          ],
        },
        {
          name: "div",
          attrs: {
            class: "div-class",
            style: "margin-left: 6px; margin-top: 6px;",
          },
          children: [
            {
              type: "text",
              text: "2、初诊提前3天预约；复诊可直接与主诊医生预约，无时限要求。",
            },
          ],
        },
        {
          name: "div",
          attrs: {
            class: "div-class",
            style: "margin-left: 6px; margin-top: 6px;",
          },
          children: [
            {
              type: "text",
              text: "3、患者至少提前24小时进行预约挂号，每天16:30截止第二天号源的预约。",
            },
          ],
        },
      ],

      checkeFlag: false,
    };
  },
  onLoad(option) {
    this.init();
  },

  methods: {
    init() {
      //信息初始化
    },

    // 点击勾选框
    checke() {
      this.checkeFlag = !this.checkeFlag;
      console.log(this.checkeFlag);
    },
    // 取消
    cancel() {
      alert("取消");
    },
    // 确认
    sure() {
      alert("确认");
    },
  },
};
</script>

<style scoped>
.notice_box {
  color: #333;
  width: 96%;
  padding: 20px;
  box-sizing: border-box;
  margin: 0 auto;
  background: #ffffff;
  margin-top: 10px;
  border-radius: 6px;
  position: relative;
}
/* 文本框 */
.notice_title {
  font-size: 18px;
  line-height: 30px;
  font-weight: 700;
  margin-bottom: 10px;
}
.notice_text {
  border: 1px solid #3692ff;
  width: 100%;
  display: inline-block;
  font-size: 14px;
  min-height: 480px;
}

/* 用户确认组 */
.notice_sureBox {
  background-color: #fff;
  position: fixed;
  padding: 0 8px;
  box-sizing: border-box;
  bottom: 0;
  height: 100px;
  width: 100%;
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.3);
}
/* 单选框Box */
.notice_sureBox .notice_check {
  margin-top: 10px;
  font-size: 14px;
  color: #3b3b3b;
}
/* 单选框大小 */
.notice_sureBox .notice_check checkbox {
  transform: scale(0.6);
}

/* 按钮组 */
.notice_btnBox {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
}
/* 按钮 */
.notice_btnBox button {
  display: inline-block;
  width: 48%;
  height: 40px;
  border-radius: 4px;
  padding: 0;
  margin: 0;
  font-size: 16px;
}
/* 取消按钮 */
.notice_btnBox .notice_cancel {
  border: 1px solid #ccc;
  outline: none;
  background-color: #fff;
  color: #999;
}
/* 确认按钮 */
.notice_btnBox .notice_sure {
  background-color: #3692ff;
  color: #fff;
}
/* 禁止确认 */
.notice_btnBox .isChecke {
  background-color: #999999;
}
</style>
